const distinguishFileType = function () {
  if (this.modelPath) {
    const fileType = this.modelPath
      .substring(this.modelPath.lastIndexOf(".") + 1)
      .toLowerCase();
    if (fileType !== 'fbx') {
      this.notFound('Models other than FBX are not supported at present');
      return;
    }
    const _this = this;
    this.modalType = fileType.toUpperCase();
    const typeMap = {
      fbx: this.fbxLoadModel.bind(_this),
      // "3dm": this.loaderFor3DM.bind(_this),
      // "3ds": this.loaderFor3DS.bind(_this),
      // glb: this.glbLoadModel.bind(_this),
      // stl: this.stlLoader.bind(_this),
      // obj: this.objLoader.bind(_this),
      // ply: this.plyLoader.bind(_this),
    };
    typeMap[fileType]();
  } else {
    this.notFound();
    this.panel === '1' && this.createPanel();
  }
};

export default distinguishFileType;
